package generalEvolutionaryAlgorithm;

public class EAResult {
	public EAInstance optimalInstance;
	public EAValue optimalValue;
	public EAResult(EAInstance optimalInstance, EAValue optimalValue){
		this.optimalInstance = optimalInstance;
		this.optimalValue = optimalValue;
	}
	public static EAResult best(EAResult result1, EAResult result2) {
		if(result1 == null)return result2;
		if(result2 == null)return result1;
//		System.out.println("res1 " + result1.optimalValue);
//		System.out.println("res2 " + result2.optimalValue);
		if(result2.optimalValue.compareTo(result1.optimalValue) <= 0){
//			System.out.println("take2");
			return result2;
		} else {
//			System.out.println("take1");
			return result1;
		}
	}
}
